'use strict';
const db = uniCloud.database()
const uniID = require('uni-id')
exports.main = async (event, context) => {
	//event为客户端上传的参数
	console.log('event : ', event)
	const user= await uniID.checkToken(event.uniIdToken)
	console.log(user)
	
	let res = db.collection('uni-id-users')
	.where({
		_id:user.uid
	})
	.update({
		nickname:event.nickname,
		avatar:event.avatar,
		mobile:event.mobile
	})
	//返回数据给客户端
	return res
};
